home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Programming
/
AsyncIO
/
src
/
WriteCharAsync.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-06-04
|
692b
|
35 lines
#include "async.h"
_CALL LONG
WriteCharAsync( _REG( a0 ) AsyncFile *file, _REG( d0 ) UBYTE ch )
{
if( file->af_BytesLeft )
{
/* if there's any room left in the current buffer, directly write
* the byte into it, updating counters and stuff.
*/
*file->af_Offset = ch;
--file->af_BytesLeft;
++file->af_Offset;
/* one byte written */
return( 1 );
}
/* there was no room in the current buffer, so call the main write
* routine. This will effectively send the current buffer out to disk,
* wait for the other buffer to come back, and then put the byte into
* it.
*/
{
TEXT c;
c = ch; /* SAS/C workaround... */
return( WriteAsync( file, &c, 1 ) );
}
}